<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/denglu.css">
    <link rel="stylesheet" href="../font_dhlvhacrrx/iconfont.css">
    <script src="../js/denglu.js"></script>
    <script src="../js/ajax.js"></script>
</head>

<body>
    <header>
        <div id="h_con">
            <div class="top_nav">
                <ul>
                    <li>
                        <a href="">注册</a>
                    </li>
                    <li>
                        <a href="html/login.html" class="border_r">登录</a>
                    </li>
                    <li>
                        <a href="" class="border_r">我的账户</a>
                        <div class="zhanghu_erji">
                            <p>
                                <a href="">我的订单</a></p>
                            <p>
                                <a href="">我的优惠券</a></p>
                        </div>

                    </li>
                    <li>
                        <a href="" class="border_r">客服中心</a>
                        <div class="kefu_erji">
                            <p>
                                <a href="">企业团购</a></p>
                            <p>
                                <a href="">退换货政策</a></p>
                            <p>
                                <a href="">在线客服</a></p>
                            <p>
                                <a href="">订购热线</a></p>
                            <p>
                                <a href="">400-1985-00</a></p>
                        </div>
                    </li>
                    <li>
                        <a href="">订单查询</a>
                    </li>
                </ul>
            </div>
            <div class="center_nav">
                <div class="logina">
                    <a href="">
                        <img src="../images/logo_03.jpg" alt="">
                    </a>
                </div>
                <div class="sousuo">
                    <a href="">
                        <span>
                            <i></i>
                            搜索
                        </span>
                    </a>
                </div>
                <div class="gouwuche">
                    <a href="">
                        <p>
                            <i></i> 购物车
                            <span>
                                0
                            </span>
                        </p>
                    </a>
                </div>
            </div>
        </div>
    </header>
    <div id="main">
        <div id="main_con">
            <div id="denglu">
                <h2 class="denglu_h2">登录</h2>
                <p class="zc_p zc_pd">如果您已经是我们的会员，请在此登录</p>
                <input type="text" placeholder="请输入您的常用手机号" class="ipt_phone cba">
                <input type="password" placeholder="请输入6-16位密码" class="ipt_pass cbaa">

                <p class="cbox">
                    <input type="checkbox"> 15天内免登录
                </p>
                <div class="denglu_div">

                    <button type="button" class="login">登录</button>
                </div>
                <p class="dlfs">
                    其他登录方式 ：
                </p>
                <div class="dl_123">
                    <span>
                        <i><img src="../images/登录注册_03.jpg" alt=""></i>
                        验证码登录
                    </span>
                    <span>
                        <i><img src="../images/登录注册_05.jpg" alt=""></i>
                        QQ登录
                    </span>
                    <span>
                        <i><img src="../images/登录注册_07.jpg" alt=""></i>
                        支付宝登录
                    </span>
                </div>

            </div>




            <div id="zhuce">
                <h2 class="denglu_h2">注册</h2>
                <p class="zc_p">注册即可成为TOMMY HILFIGER会员，立赠200元组合礼券。</p>
                <p class="zc_p">消费满额可升级TOMMY HILFIGER VIP会员，尊享更多优惠，
                    <a href="javascript:;">点击了解详情</a>
                </p>
                <input type="text" placeholder="请输入您的常用手机号" class="ipt_phone User">
                <div class="ipt_img">
                    <input type="text" placeholder="请输入图形验证码">
                    <div class="yzm">
                        <span>换一张</span>
                    </div>
                </div>
                <div class="ipt_dx">
                    <input type="text" placeholder="请输入短信验证码">
                    <div class="hdx">
                        获取验证码
                    </div>
                </div>
                <input type="password" placeholder="请输入6-16位密码" class="ipt_phone Pass">
                <input type="text" placeholder="请输入生日" class="ipt_phone">
                <input type="text" placeholder="请输入邮箱" class="ipt_phone">
                <p class="bitain">
                    标
                    <span>*</span> 的为必填
                </p>
                <p class="cbox_2">
                    <input type="checkbox"> 我接受
                    <用户协议>及其相关的条款并承诺点击“注册”按钮即表示我已经阅读并接受用户协议
                </p>
                <div class="zhuce_div">
                    <!-- <input type="button" value="注册" class="zhuce"> -->
                    <button type="button" class="zhuce">注册</button>
                </div>
            </div>
        </div>
    </div>
    <!-- ---------------------登录------------------- -->
    <script>
        let oUser = document.querySelector('.cba')
        let oPass = document.querySelector('.cbaa')
        let oLogin = document.querySelector('.login')

        // 登录
        oLogin.onclick = function() {
            alert("1")
            ajax({
                url: '../php/login.php',
                type: 'post',
                data: {
                    username: oUser.value,
                    password: oPass.value
                },
                success(res) {
                    // console.log(res)
                    let obj = JSON.parse(res)

                    if (obj.status === true) {
                        alert(obj.msg)
                        location.href = '../index.html'

                        sessionStorage.setItem('username', obj.username)
                    } else {
                        alert(obj.msg)
                    }
                }
            })
        }
    </script>

</body>

</html>